/**
  CNOK project, Anyang Normal University, IMP-CAS
  \class TAExpData
  \brief error propagation
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2022/05/23
  \date Last modified: 2022/05/23 by SUN Yazhou
  \copyright 2020-2023 SUN Yazhou
  \copyright CNOK project, Anyang Normal University, IMP-CAS
*/

# ifndef TAExpData_H_
# define TAExpData_H_

class TAExpData{
public:
	TAExpData(double val = 0., double err = 0.);
	virtual ~TAExpData(){}

	TAExpData(const TAExpData &data);
	TAExpData &operator=(const TAExpData &data);

	void print() const;
	friend std::ostream &operator<<(std::ostream &os, const TAExpData &data);

	double val() const{ return fVal; }
	double err() const{ return fErr; }
	double v() const{ return fVal; }
	double e() const{ return fErr; }
	void SetVal(double val){ fVal = val; }
	void SetErr(double err){ fErr = err; }

	const TAExpData &operator+=(const TAExpData &);
	const TAExpData &operator-=(const TAExpData &);
	const TAExpData &operator*=(const TAExpData &);
	const TAExpData &operator/=(const TAExpData &);
	TAExpData operator+(const TAExpData &) const;
	TAExpData operator-(const TAExpData &) const;
	TAExpData operator*(const TAExpData &) const;
	TAExpData operator/(const TAExpData &) const;

protected:
	double fVal;
	double fErr;
};

TAExpData Sqrt(const TAExpData &p);
TAExpData Log(const TAExpData &p);
TAExpData operator+(double k, const TAExpData &p);
TAExpData operator-(double k, const TAExpData &p);
TAExpData operator*(double k, const TAExpData &p);
TAExpData operator/(double k, const TAExpData &p);
TAExpData Exp(const TAExpData &p);

# endif
